<?php
class Runtime{
	
    private $begintime = 0;
    private $endtime   = 0;
    
    private function gettime(){
        list($usec,$sec) = explode(" ", microtime());
        return ((float)$usec + (float)$sec);
    }
    
    public function begin(){
        $this->begintime = $this->gettime();
    }
    
    public function end(){    
        $this->endtime = $this->gettime();
    }
    
    public function spent(){
        return $this->endtime - $this->begintime;
    }
    
}
